﻿namespace StyleCop.For.ReSharper.TestProject.Ordering
{
    #region Using Directives

    using System;

    #endregion

    internal class SA1212PropertyWithGetAndSetMustHaveGetFirst
    {
        #region Constants and Fields

        private int[] myArray = new int[100];

        private string property2;

        #endregion

        #region Events

        public event EventHandler MyEvent
        {
            remove
            {
                Console.WriteLine("remove operation");
            }

            add
            {
                Console.WriteLine("add operation");
            }
        }

        #endregion

        #region Public Properties

        public string Property1 { set; get; }

        public string Property2
        {
            set
            {
                if (value != null)
                {
                    this.property2 = value;
                }
            }

            get
            {
                return this.property2;
            }
        }

        #endregion

        #region Public Indexers

        public int this[int index]
        {
            set
            {
                if (!(index < 0 || index >= 100))
                {
                    this.myArray[index] = value;
                }
            }

            get
            {
                if (index < 0 || index >= 100)
                {
                    return 0;
                }

                return this.myArray[index];
            }
        }

        #endregion
    }
}